package com.foton.servletdemo.servlet;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Author RenPu
 * @Date 2023/3/15 17:18
 * @Version 1.0
 * @Description: servlet3.0之前，服务器（tomcat,jetty内部拥有自己的线程池）内部的请求都是由一个线程，
 *               采用BIO的模式进行处理的，从而会大大的影响服务的吞吐量以及效率
 **/
@WebServlet("/test1")
public class ServletSync extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        System.out.println("当前线程为：：："+Thread.currentThread().getName());
        new DoSomething().run();
        resp.getWriter().write("OK get a Reponse ;;;;;;;");
    }
}
